package com.choudou5.solr.bean;

import com.choudou5.solr.framework.bean.BaseBean;
import com.choudou5.solr.util.GzipUtil;
import com.choudou5.solr.util.JsonUtil;
import com.choudou5.solr.util.StrUtil;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @@name 搜索日志
 * @@author choudou5
 * @@date 2018-7-13
 */
public class SearchHiBean extends BaseBean<Long> {

    private Long id;
    /** 模块 */
    private String module;
    /** 关键字 */
    private String keyword;
    /** 查询条件 */
    private String queryStr;
    /** 分页开始下标 */
    private int start;
    /** 请求耗时(毫秒) */
    private long qTime;
    /** 命中记录数 */
    private long numFound;
    /** 查询结果 */
    private String result;
    /** 客户端类型：web、android、ios */
    private String clientType;
    /** 创建人 */
    private String uid;
    /** 创建时间 */
    private Date createTime;

    private List<Map> resultList;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getModule() {
        return module;
    }

    public void setModule(String module) {
        this.module = module;
    }

    public String getKeyword() {
        return keyword;
    }

    public void setKeyword(String keyword) {
        this.keyword = keyword;
    }

    public String getQueryStr() {
        return queryStr;
    }

    public void setQueryStr(String queryStr) {
        this.queryStr = queryStr;
    }

    public int getStart() {
        return start;
    }

    public void setStart(int start) {
        this.start = start;
    }

    public long getqTime() {
        return qTime;
    }

    public void setqTime(long qTime) {
        this.qTime = qTime;
    }

    public long getNumFound() {
        return numFound;
    }

    public void setNumFound(long numFound) {
        this.numFound = numFound;
    }

    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.result = result;
    }

    public String getClientType() {
        return clientType;
    }

    public void setClientType(String clientType) {
        this.clientType = clientType;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public void setResultList(List<Map> resultList) {
        if(resultList != null)
            this.resultList = resultList;
    }

    public List<Map> getResultList() {
        if(StrUtil.isNotBlank(result)){
            this.resultList = JsonUtil.toJavaObjList(GzipUtil.uncompress(result), Map.class);
        }
        return this.resultList;
    }
}
